package com.yh.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import com.yh.bean.HelpFirst;
import com.yh.bean.HelpInfo;
import com.yh.bean.HelpSecond;
import com.yh.dao.HelpDao;
import com.yh.service.HelpService;

@Controller
public class HelpServiceImpl implements HelpService {

	@Autowired
	private HelpDao helpDao;
	
	//查看一级分类表
	@Override
	public List<HelpFirst> lookHelpFirst() {
		// TODO Auto-generated method stub
		List<HelpFirst> firstList = helpDao.queryHelpFirst();
		return firstList;
	}

	//查看二级分类表
	@Override
	public List<HelpSecond> lookHelpSecond(int firId) {
		// TODO Auto-generated method stub
		List<HelpSecond> secondList = helpDao.queryHelpSecond(firId);
		return secondList;
	}

	//查看帮助中心表
	@Override
	public List<HelpInfo> lookHelpInfo(int secId) {
		// TODO Auto-generated method stub
		List<HelpInfo> infoList = helpDao.queryHelpInfo(secId);
		return infoList;
	}

	//删除帮助信息
	@Override
	public boolean deleteInfo(int id) {
		// TODO Auto-generated method stub
		int delete = helpDao.deleteInfo(id);
		if(delete>=1){
			return true;
		}else{
			return false;
		}
	}

	//查询后修改帮助
	@Override
	public List<HelpInfo> loadInfo(int id) {
		// TODO Auto-generated method stub
		List<HelpInfo> infoL = helpDao.queryInfo(id);
		return infoL;
	}
	
	//修改帮助中心
	@Override
	public boolean updateInfo(HelpInfo helpInfo) {
		// TODO Auto-generated method stub
		int update = helpDao.updateInfo(helpInfo);
		if(update>=1){
			return true;
		}else{
			return false;
		}
	}

	//添加帮助中心
	@Override
	public boolean addInfo(HelpInfo helpInfo) {
		int add = helpDao.addInfo(helpInfo);
		if(add>=1){
			return true;
		}else{
			return false;
		}
	}

	

}
